package org.examples;

public class DebugConstants {
  //  public final static String host = "httpbin.org";
  //public final static String host = "tts-qa.na.onecloud.hosting.cerence.net";
  //public final static String host = "httpbin-qa.na.onecloud.hosting.cerence.net";
  //public final static String host = "10.71.20.181:9090";
//  public final static String host = "47.108.196.76:8888";
  public final static String host = "10.192.128.28:28166";
  //public final static String host = "127.0.0.1:8080";

  public final static String nttsJson =
      "{\"audio\": {\"format\": \"opus_ogg\"}, \"text\": {\"contentType\": \"text/plain\", \"content\":"
          + " \"1 2 3\"}, \"voice\": {\"voiceId\": \"zoe\"}}";

  //The result will be millions of Americans who have insurance who did not have it before. Thats the goal. And the goal is not about the website. The goal is that the American people who have been shut out of affordable health care options in the past have those options available to them.
  public static boolean isHttpbin() {
    return host.startsWith("http") || host.startsWith("47") || host.startsWith("127");
  }

  public static boolean isHttps() {
    return host.endsWith(".net");
  }

  public static String schema() {
    return isHttps() ? "https" : "http";
  }

  public static String fullSchema() {
    return schema() + "://";
  }

  public static String nttsPath() {
    return isHttpbin() ? "/post" : "/v1/synthesize";
  }

  public static String vocsPath() {
    return isHttpbin() ? "/post" : "/vocs/speak";
  }

  public static String gwPath() {
    return isHttpbin() ? "/post" : "/NmspServlet";
  }

  public static final String vocsInputJson =
      "{\"data\": \"The result will be millions of Americans who have insurance who did not have it before.Thats the goal. And the goal is not about the website.\", \"content_type\": \"text/plain;charset=iso8859-1\", "
          + "\"content_encoding\":"
          + " \"8bit\"}";

  public static final String longVocsInputJson =
      "{\"data\": \"The result will be millions of Americans who have insurance who did not have it before.Thats the goal. And the "
          + "goal is not about the website. Each method in the above picture will generate a new view that shares the same "
          + "underlying data with the original buffer. To understand a new view, we should be concerned about two problems. The "
          + "ByteBuffer also provides other views: asCharBuffer(), asShortBuffer(), asIntBuffer(), asLongBuffer(), asFloatBuffer(), and asDoubleBuffer(). These methods are similar to the slice() method, i.e. they provide a sliced view corresponding to the underlying data's current position and limit. The main difference between them is interpreting the underlying data into other primitive type values.The new view will compose multiple bytes into the target primitive type, and it starts the interpretation from the current position of the original buffer. The new view will have a capacity equal to the number of remaining elements in the original buffer divided by the number of bytes comprising the view's primitive type. Any remaining bytes at the end will not be visible in the view.What is a direct buffer? A direct buffer refers to a buffer's underlying data allocated on a memory area where OS functions can directly access it. A non-direct buffer refers to a buffer whose underlying data is a byte array that is allocated in the Java heap area.Why do we need a direct buffer? The answer is simple: a non-direct buffer always incurs unnecessary copying operations. When sending a non-direct buffer's data to I/O devices, the native code has to “lock” the underlying byte array, copy it outside the Java heap, and then call the OS function to flush the data. However, the native code can access the underlying data directly and call OS functions to flush the data without any additional overhead by using a direct buffer.\n"
          + "\n"
          + "In light of the above, is a direct buffer perfect? No. The main problem is that it's expensive to allocate and deallocate a direct buffer. So, in reality, does a direct buffer always run faster than a non-direct buffer? Not necessarily. That's because many factors are at play. And, the performance tradeoffs can vary widely by JVM, operating system, and code design.\n"
          + "\n"
          + "Finally, there is a practical software maxim to follow: First, make it work, then, make it fast. That means, let's first concentrate on code correctness. If the code doesn't run fast enough, then let's do the corresponding optimization.\", "
          + "\"content_type\": \"text/plain;charset=iso8859-1\", "
          + "\"content_encoding\":"
          + " \"8bit\"}";


  public static final String vocsParametersJson = "{\"language\": \"en-us\", \"voice\": \"zoe-ml\", \"volume\": \"80\", "
      + "\"audio_chunk_duration_ms\": \"20000\", \"sample_rate\": \"16000\", \"output_type\": \"10\", \"rate\": \"50\", \"session_id\": \"e73db992-5301-4a85-b333-2b4e77e9db81\",\"log_event\": \"1\",\"lipsync_info\": \"1\"}";

  public static final String gwRequestData = "{\n"
      + "    \"appKey\": \"525348e77144a9cee9a7471a8b67c50ea85b9e3eb377a3c1a3a23db88f9150eefe76e6a339fdbc62b817595f53d72549d9ebe36438f8c2619846b963e9f43a93\",\n"
      + "    \"appId\": \"SAMPLE_DEBUG_NMAID_TO_BE_REPLACED\",\n"
      + "    \"outCodec\": \"OPUS_16K\",\n"
      + "    \"cmdName\": \"NVC_TTS_CMD\",  \n"
      + "    \"cmdDict\": {\n"
      + "        \"tts_language\":\"zh-CN\",\n"
      + "        \"tts_voice\":\"lili-ml\" ,\n"
      + "    }\n"
      + "}";

  public static final String gwTtsParameter = "{\n"
      + "   \"tts_type\": \"text\",\n"
      + "   \"tts_input\":\"我觉得性别只是一种参考值,不是限制思维的理由\"\n"
      + "}";

}
